package com.k8s.base.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * 机构专属域名配置
 */
@Entity
@Table(name = "domain_config")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class DomainConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 所属机构
     */
    @Column(name = "office_id")
    private Long officeId;

    /**
     * 域名
     */
    @Size(max = 100)
    @Column(name = "domain_name", length = 100)
    private String domainName;

    /**
     * 登录页配置（JSON）
     */
    @Size(max = 1000)
    @Column(name = "login_page", length = 1000)
    private String loginPage;

    /**
     * 主框架页配置（JSON）
     */
    @Size(max = 1000)
    @Column(name = "main_page", length = 1000)
    private String mainPage;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private ZonedDateTime createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private ZonedDateTime updateTime;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOfficeId() {
        return officeId;
    }

    public DomainConfig officeId(Long officeId) {
        this.officeId = officeId;
        return this;
    }

    public void setOfficeId(Long officeId) {
        this.officeId = officeId;
    }

    public String getDomainName() {
        return domainName;
    }

    public DomainConfig domainName(String domainName) {
        this.domainName = domainName;
        return this;
    }

    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }

    public String getLoginPage() {
        return loginPage;
    }

    public DomainConfig loginPage(String loginPage) {
        this.loginPage = loginPage;
        return this;
    }

    public void setLoginPage(String loginPage) {
        this.loginPage = loginPage;
    }

    public String getMainPage() {
        return mainPage;
    }

    public DomainConfig mainPage(String mainPage) {
        this.mainPage = mainPage;
        return this;
    }

    public void setMainPage(String mainPage) {
        this.mainPage = mainPage;
    }

    public ZonedDateTime getCreateTime() {
        return createTime;
    }

    public DomainConfig createTime(ZonedDateTime createTime) {
        this.createTime = createTime;
        return this;
    }

    public void setCreateTime(ZonedDateTime createTime) {
        this.createTime = createTime;
    }

    public ZonedDateTime getUpdateTime() {
        return updateTime;
    }

    public DomainConfig updateTime(ZonedDateTime updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public void setUpdateTime(ZonedDateTime updateTime) {
        this.updateTime = updateTime;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        DomainConfig domainConfig = (DomainConfig) o;
        if (domainConfig.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), domainConfig.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "DomainConfig{" +
            "id=" + getId() +
            ", officeId=" + getOfficeId() +
            ", domainName='" + getDomainName() + "'" +
            ", loginPage='" + getLoginPage() + "'" +
            ", mainPage='" + getMainPage() + "'" +
            ", createTime='" + getCreateTime() + "'" +
            ", updateTime='" + getUpdateTime() + "'" +
            "}";
    }
}
